<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
    // 打开一个 web socket
    var ws = new WebSocket("ws://47.97.108.227:8802");

    ws.onopen = function()
    {
        // Web Socket 已连接上，使用 send() 方法发送数据
        ws.send("发送数据");
        alert("数据发送中...");
    };

    ws.onmessage = function (evt)
    {
        var received_msg = evt.data;
        alert("数据已接收...");
    };

    ws.onclose = function()
    {
        // 关闭 websocket
        alert("连接已关闭...");
    };
</script>
</html>